﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EntityComponentSystem.Framework.Systems
{
    public interface IIntervalEntitySystem : IEntitySystem
    {

    }

    public abstract class IntervalEntitySystem : EntitySystem
    {
        private string name = null;

        public override string Name { get { return name; } }
        public float Interval { get; set; }
        public float NextInterval { get; private set; }

        public IntervalEntitySystem(string name)
        {
            this.name = name;
        }

        public override void Update(GameEngine ge)
        {
            NextInterval -= ge.TimeSinceLastFrame;
            if (NextInterval <= 0f)
            {
                NextInterval = Interval;
                base.Update(ge);
            }
        }
        
    }

}
